engine = current_node.engine
upstream "engine_at_#{current_node.name}" do
  ip_hash;
  1.upto(engine.servers) do |i|
    port = engine.port + i-1
    server current_node.ip,port
  end
end

engines = engine.engines
engines.each_pair do |name, engine|
  location engine["url"],"engine_at_#{current_node.name}"
end

location "/api/v1/lcn", "engine_at_#{current_node.name}", :alias => "portal/api/v1/lcn"
location "/api/v1/auth", "engine_at_#{current_node.name}", :alias => "aaa/api/v1/auth"